// import Vue from "vue";

const map = new WeakMap()

const ob = new ResizeObserver((entries) => {
    for (const entry of entries) {
        const handler = map.get(entry.target)
        handler && handler(entry)
    }
})

export default {
    bind(el, binding) {
        map.set(el, binding.value)
        ob.observe(el)
    },
    unbind(el) {
        ob.unobserve(el)
    }
}